package com.qf.spring.test;

import com.qf.spring.dao.UserDao;
import com.qf.spring.service.UserService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 郑大仙丶
 * @version 1.0
 * @date 2021/3/19 14:56
 * 使用IOC注解创建实例
 */
public class Demo1 {

    @Test
    public void test(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");

        UserService userService = (UserService) ac.getBean("userServiceImpl");

        System.out.println(userService);

        UserDao userDao1 = (UserDao) ac.getBean("userDaoImpl");
        UserDao userDao2 = (UserDao) ac.getBean("userDaoImplement");


        System.out.println("111");
    }

}
